//
//  GlobalAddTableCell.swift
//  ZYA
//
//  Created by 邱仙凯 on 2021/11/18.
//  Copyright © 2021 aowang. All rights reserved.
//

import UIKit

class GlobalAddTableCell: UITableViewCell {
    lazy  var bottomBg:UIView = {
        let v = UIView()
         return v
    }()
    lazy  var whiteBg:UIView = {
        let v = UIView()
        v.backgroundColor = .white
  
        
         return v
    }()
    lazy  var cornerBg:UIView = {
        let v = UIView()
        v.backgroundColor = TempDetBg
        v.layer.cornerRadius = 8
        v.layer.masksToBounds = true
        return v
    }()
    lazy var titleLab:UILabel = {
        let v = UILabel()
        v.font = UIFont.systemFont(ofSize: 16)
        v.textColor = UIColor.lightGray
        return v
    }()
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.selectionStyle = .none
        self.backgroundColor = .clear
        self.contentView.backgroundColor = .clear
        self.bottomBg.backgroundColor = Theme.awModuleBgColor
        self.contentView.addSubview(bottomBg)
        contentView.addSubview(whiteBg)
        bottomBg.snp.makeConstraints { make in
            make.edges.equalToSuperview()
        }
        whiteBg.snp.makeConstraints { make in
            make.left.equalTo(self.contentView).offset(6)
            make.top.equalTo(self.contentView)
            make.right.equalTo(self.contentView).offset(-6)
            make.bottom.equalTo(self.contentView)
        }
        whiteBg.addSubview(cornerBg)
        cornerBg.snp.makeConstraints { make in
            make.left.equalToSuperview().offset(10)
            make.top.equalToSuperview().offset(10)
            make.right.equalToSuperview().offset(-10)
            make.bottom.equalToSuperview().offset(-10)
        }
        cornerBg.addSubview(titleLab)
        titleLab.snp.makeConstraints { make in
            make.centerY.equalTo(cornerBg)
            make.left.equalTo(cornerBg).offset(15)

        }
     }
    // 定制了出差的样式
   func setRoundType() {
       bottomBg.backgroundColor = .white
       bottomBg.snp.remakeConstraints { make in
           make.left.equalToSuperview().offset(6)
            make.right.equalToSuperview().offset(-6)
           make.bottom.equalToSuperview()
           make.top.equalToSuperview()
       }

       cornerBg.snp.remakeConstraints { make in
           make.left.equalToSuperview().offset(6)
           make.top.equalToSuperview().offset(8)
           make.right.equalToSuperview().offset(-6)
           make.bottom.equalToSuperview().offset(-8)
       }
       
       let leftCor = CornerView(width: 8, outColor: Theme.awModuleBgColor, innerColor: .white, type: .leftBottom)
       bottomBg.addSubview(leftCor)
       leftCor.snp.makeConstraints { make in
           make.left.bottom.equalToSuperview()
           make.width.height.equalTo(8)
       }
       let rightCor = CornerView(width: 8, outColor: Theme.awModuleBgColor, innerColor: .white, type: .rightBottom)
       bottomBg.addSubview(rightCor)
       rightCor.snp.makeConstraints { make in
           make.right.bottom.equalToSuperview()
           make.width.height.equalTo(8)
       }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
class GlobalAddTableFooter: UIView {
    lazy  var bg:UIView = {
        let v = UIView()
        v.backgroundColor = .white
        v.layer.cornerRadius = 8
        v.layer.masksToBounds = true
        return v
    }()
    lazy var titleLab:UILabel = {
        let v = UILabel()
        v.font = UIFont.systemFont(ofSize: 16)
        v.textColor = Theme.ORANGE
        return v
    }()
    override init(frame:CGRect) {
        super.init(frame: frame)
         self.backgroundColor = Theme.awModuleBgColor
        self.addSubview(bg)
        bg.snp.makeConstraints { make in
            make.left.equalTo(self).offset(6)
            make.top.equalTo(self).offset(6)
            make.right.equalTo(self).offset(-6)
            make.bottom.equalTo(self)
        }
        bg.addSubview(titleLab)
        titleLab.snp.makeConstraints { make in
            make.centerY.centerX.equalTo(bg)
        }
     }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
